const convertToTitle = columnNumber => {
  let ans = [];
  while (columnNumber > 0) {
    const a0 = (columnNumber - 1) % 26 + 1;
    ans.push(String.fromCharCode(a0 - 1 + 'A'.charCodeAt()));
    columnNumber = Math.floor((columnNumber - a0) / 26)
  }
  
  ans.reverse()
  return ans.join('')
}


console.log(convertToTitle(28));